package com.wxs.service.impl;

import com.wxs.mapper.TSignInMapper;
import com.wxs.po.TSignIn;
import com.wxs.po.TSignInStudent;
import com.wxs.service.TSignInService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;
import java.util.Calendar;
import java.util.List;

@Service
public class TSignInServiceImpl implements TSignInService {

    @Autowired
    TSignInMapper tSignInMapper;

    public TSignIn findAllCourseById(Integer courseId) {
        return tSignInMapper.findAllCourseById(courseId);
    }

    public int getCourseNum(Integer courseId) {
        return tSignInMapper.getCourseNum(courseId);
    }

    public int insertSignIn(Integer courseId) {
        long timeInMillis = Calendar.getInstance().getTimeInMillis();
        Timestamp date = new Timestamp(timeInMillis);
        return tSignInMapper.insertSignIn(courseId,0,date);
    }

    public List<TSignIn> findSignInListById(Integer courseId) {
        return tSignInMapper.findSignInListById(courseId);
    }

    public List<TSignInStudent> findStudentById(Integer signInId){
        return tSignInMapper.findStudentById(signInId);
    }
}
